DESCRIPTION
The same new flexibility in creating color worlds is
extended to link profiles, which are now not assumed to go
from input device color space to output device color space.
The returned profile is open, and should be closed when you
are finished with it.
CMError
|
NCMSetSystemProfile (const
CMProfileLocation *profLoc);
|
Field Descriptions
profLoc
|
The location of the profile, which you specify
using the CMProfileLocation data type.
Commonly a profile is disk-file based. However, the
profile may be a file-based profile, a handle-based
profile, or a pointer-based profile.
|
DESCRIPTION
Prior to ColorSync 2.6, the API for setting the System
Profile supported only the FSSpec file
specification type as a way of specifying a profile. This
new API allows for greater flexibility when specifying a
system profile.
CMError NCMUnflattenProfile (CMProfileLocation *targetLocation,
CMFlattenUPP proc,
void *refCon,
Boolean *preferredCMMnotfound);
|
Field Descriptions
targetLocation
|
The location of the profile you wish to
unflatten, which you specify using the
CMProfileLocation data type. Commonly
a profile is disk-file based. However, the profile
may be a file-based profile, a handle-based
profile, or a pointer-based profile.
|
proc
|
A user-defined procedure which is called during
the unflatten operation.
|
refCon
|
A reference constant containing data specified
by the calling application program.
|
preferredCMMnotfound
|
A return value indicating whether or not the CMM
specified in the profile was found.
|
DESCRIPTION
Use this function to unflatten a profile.
CMError CMIterateCMMInfo (CMMIterateUPP proc,
UInt32 *count,
void *refCon);
|
Field Descriptions
proc
|
A calling-program-supplied callback function
that allows your application to monitor progress or
abort the operation.
|
count
|
A count of the number of CMMs referenced is
returned here.
|
refCon
|
A reference constant containing data specified
by the calling application program.
|
NEW STRUCTURES FOR USE WITH THIS FUNCTION
OSErr CMMIterateUPP(
CMMInfo* iterateData, /* Ptr to a structure containing
/* information about a particular CMM */
void* refcon /* Caller-defined data, passed through from CMIterateCMMInfo
API */
);
struct CMMInfo {
unsigned long dataSize; /* Size of this structure - for compatibility */
OSType CMMType; /* Signature of CMM */
OSType CMMMfr; /* Vendor, e.g. 'appl */
unsigned long CMMVersion; /* Version number */
Handle CMMIcons; /* If available, can be a group with varying size
& depth */
unsigned char ASCIIName[32]; /* Pascal string - name */
unsigned char ASCIIDesc[256]; /* Pascal string - description or copyright */
UniCharCount UniCodeNameCount; /* Count of UniChars in following array */
UniChar UniCodeName[32]; /* The name in UniCode chars */
UniCharCount UniCodeDescCount; /* Count of UniChars in following array */
UniChar UniCodeDesc[256]; /* The description in UniCode chars */
};
|
DESCRIPTION
The CMIterateCMMInfo function returns
information for all CMMs installed on the system. The caller
can pass nil for the CMMIterateUPP param to
simply get a count of CMMs. If a CMMIterateUPP
proc is provided, it will be called once for each CMM
installed - with the CMMInfo structure filled
accordingly. The caller can pass a data reference to
CMIterateCMMInfo which will then be passed to
the CMMIterateUPP . This might be used to allow
some of the information in the CMMInfo data
structure to be put into a menu, for example, by passing a
menu reference as the refcon. Either the proc or the count
parameter must be provided. The caller will get a paramErr
if both are nil.
CMError
|
CMGetColorSyncVersion (UInt32
*version);
|
Field Descriptions
version
|
The version of ColorSync installed on the
machine is returned here
|
DESCRIPTION
Returns ColorSync version information.
CMGetColorSyncVersion relieves the Mac OS
developer from having to call Gestalt to find
out the version of ColorSync installed on the system.
Important Note:
The return value for ColorSync 2.6 is
0x00026000 on the Macintosh. This is
not consistent with what is currently returned by
Gestalt (0x00000260 ).
Future versions of ColorSync on the Macintosh will
be fixed so they are consistent with
Gestalt return values.
|
Back to top
Deprecated APIs
Support for the following APIs will be eliminated or limited
in the future:
API
|
ColorSyncVersion
|
Reason for Deprecation
|
(CM)BeginMatching
|
1.x
|
Pict-based, uses 1.x Profiles
|
(CM)UseProfile(Comment)
|
1.x
|
Pict-based, uses 1.x Profiles
|
NCMUseProfileComment
|
2.x
|
Pict-based, uses 2.x Profiles
|
(CM)DrawMatchedPicture
|
1.x
|
Pict-based, uses 1.x Profiles
|
NCMDrawMatchedPicture
|
2.x
|
Pict-based, uses 2.x Profiles
|
(CM)GetProfileName
|
1.x
|
Uses 1.x Profiles
|
(CM)GetProfileAdditionalDataOffset
|
1.x
|
Uses 1.x Profiles
|
(CM)GetProfile
|
1.x
|
Profile Responder function
|
(CM)SetProfile
|
1.x
|
Profile Responder function
|
(CM)SetProfileDescription
|
1.x
|
Profile Responder function
|
(CM)GetIndexedProfile
|
1.x
|
Profile Responder function
|
(CM)DeleteDeviceProfile
|
1.x
|
Profile Responder function
|
ConcatenateProfiles
|
1.x
|
Uses 1.x Profiles
|
CWNewColorWorld
|
1.x
|
Uses 1.x Profiles
|
CMAccelerationLoadTables
|
2.x
|
CMM Function - HW acceleration no longer
supported
|
CMAccelerationCalculateData
|
2.x
|
CMM Function - HW acceleration no longer
supported
|
Back to top
New CMM APIs
The following APIs specify new CMM entry points which
ColorSync will call to handle the creation of new color
worlds or link profiles as returned by the
NCWConcatColorWorld and
NCWNewLinkProfile functions respectively. These
APIs are of interest to CMM developers only.
CMError NCMMConcatInit (CMMStorageHdl hStorage,
NCMConcatProfileSet *profileSet,
CMConcatCallBackUPP proc,
void *refCon);
|
Field Descriptions
hStorage
|
The CMM's private instance storage.
|
profileSet
|
Set of profiles to concatenate into a color
world.
|
proc
|
Callback procedure.
|
refCon
|
User data passed on to callback procedure.
|
DESCRIPTION
This is the API which ColorSync calls when an application
calls the NCWConcatColorWorld function. The new
selector for this function is kNCMMConcatInit .
The CMM is responsible for validating the profiles specified
in the profile set and for building a transform using these
profiles. If the CMM cannot build such a transform, it
should return a cmCantConcatenateErr error, or
another appropriate error code.
CMError NCMMNewLinkProfile (CMMStorageHdl hStorage,
CMProfileRef prof,
NCMConcatProfileSet *profileSet,
CMConcatCallBackUPP proc,
void *refCon);
|
Field Descriptions
hStorage
|
The CMM's private instance storage.
|
prof
|
The CMM will add the appropriate tags to this
profile.
|
profileSet
|
Set of profiles to concatenate into a link
profile.
|
proc
|
Callback procedure.
|
refCon
|
User data passed on to callback procedure.
|
DESCRIPTION
This is the API which ColorSync calls when an application
calls the NCWNewLinkProfile function. The new
selector for this function is
kNCMMNewLinkProfile . The CMM is responsible for
validating the profiles specified in the profile set and for
building a link profile using these profiles. If the CMM
cannot build a link profile, it should return a
cmCantConcatenateErr error, or another
appropriate error code. ColorSync will create the profile
(via CMNewProfile ) before calling the CMM, so
the CMM need only add the appropriate tags to the profile
before returning. ColorSync will also ensure that the tags
are written to the profile by calling
CMUpdateProfile , before returning it to the
caller.
Back to top
New ColorSync Scripting Library APIs
ColorSync 2.6 provides a new set of scripting library
APIs which are designed to give applications access to the
same file format utilities provided by the new ColorSync 2.6
AppleEvent terminology. In fact, the code in ColorSync which
responds to AppleEvents actually calls this same library.
Listed below are the functions introduced in this new
scripting library:
CMError CMValidImage (const FSSpec *spec);
|
Field Descriptions
spec
|
A file specification for the the image file you
wish to validate.
|
DESCRIPTION
This function validates the specified image file.
ColorSync will check with any installed scripting plug-ins
to see if they recognize the image's file format. If a
scripting plug-in is found which recognizes the image's file
format, CMValidateImage will return
noErr . If the image's file format is not
recognized, CMValidateImage will return the
cmInvalidImageFile error.
CMError CMGetImageSpace (const FSSpec *spec,
OSType *space);
|
Field Descriptions
spec
|
A file specification for the image file.
|
space
|
The signature of the data color space of the
color values of colors for the image file is
returned here.
|
DESCRIPTION
This function returns the signature of the data color
space in which the color values of colors in an image are
expressed.
CMError CMEmbedImage (const FSSpec *specFrom,
const FSSpec *specInto,
Boolean repl,
CMProfileRef embProf);
|
Field Descriptions
specFrom
|
A file specification for the image file.
|
specInto
|
If this parameter is a file, it specifies the
resulting image. If this parameter is a folder, it
specifies the location of the resulting image which
will have the same name as the original file. If
this parameter is not provided, the original file
is modified.
|
repl
|
If a file with the same name already exists, it
will be replaced if this parameter is set to true.
|
embProf
|
The profile to embed in the image.
|
DESCRIPTION
This function will embed an image with an ICC profile.
CMError CMUnembedImage (const FSSpec *specFrom,
const FSSpec *specInto,
Boolean repl);
|
Field Descriptions
specFrom
|
A file specification for the image file.
|
specInto
|
If this parameter is a file, it specifies the
resulting image. If this parameter is a folder, it
specifies the location of the resulting image which
will have the same name as the original file. If
this parameter is not provided, the original file
is modified.
|
repl
|
If a file with the same name already exists, it
will be replaced if this parameter is set to true.
|
DESCRIPTION
This function will remove any ICC profiles embeded in an
image.
CMError CMMatchImage (const FSSpec *specFrom,
const FSSpec *specInto,
Boolean repl,
UInt32 qual,
CMProfileRef srcProf,
UInt32 srcIntent,
CMProfileRef dstProf);
|
Field Descriptions
specFrom
|
A file specification for the image file.
|
specInto
|
If this parameter is a file, it specifies the
resulting image. If this parameter is a folder, it
specifies the location of the resulting image which
will have the same name as the original file. If
this parameter is not provided, the original file
is modified.
|
repl
|
If a file with the same name already exists, it
will be replaced if this parameter is set to true.
|
qual
|
The optional quality for the match - normal,
draft or best (cmNormalMode ,
cmDraftMode or
cmBestMode ).
|
srcProf
|
The optional source profile for the match.
|
srcIntent
|
The rendering intent for the match - perceptual
intent, relative colorimetric intent, saturation
intent, or absolute colorimetric intent
(cmPerceptual ,
cmRelativecolorimetric ,
cmSaturation or
cmAbsoluteColorimetric ).
|
dstProf
|
The destination profile for the match.
|
DESCRIPTION
Use this function to color match an image file.
CMError CMProofImage (const FSSpec *specFrom,
const FSSpec *specInto,
Boolean repl,
UInt32 qual,
CMProfileRef srcProf,
UInt32 srcIntent,
CMProfileRef dstProf,
CMProfileRef prfProf);
|
Field Descriptions
specFrom
|
A file specification for the image file.
|
specInto
|
If this parameter is a file, it specifies the
resulting image. If this parameter is a folder, it
specifies the location of the resulting image which
will have the same name as the original file. If
this parameter is not provided, the original file
is modified.
|
repl
|
If a file with the same name already exists, it
will be replaced if this parameter is set to true.
|
qual
|
The optional quality for the match - normal,
draft or best (cmNormalMode,
cmDraftMode or cmBestMode ).
|
srcProf
|
The optional source profile for the match.
|
srcIntent
|
The rendering intent for the match between the
source and destination profiles - perceptual
intent, relative colorimetric intent, saturation
intent, or absolute colorimetric intent
(cmPerceptual, cmRelativecolorimetric,
cmSaturation or
cmAbsoluteColorimetric ).
|
dstProf
|
The destination profile for the match.
|
prfProf
|
The proof profile for the match between the
destination and proof profiles.
|
DESCRIPTION
Use this function to proof an image file.
CMError CMLinkImage (const FSSpec *specFrom,
const FSSpec *specInto,
Boolean repl,
UInt32 qual,
CMProfileRef lnkProf,
UInt32 lnkIntent);
|
Field Descriptions
specFrom
|
A file specification for the image file.
|
specInto
|
If this parameter is a file, it specifies the
resulting image. If this parameter is a folder, it
specifies the location of the resulting image which
will have the same name as the original file. If
this parameter is not provided, the original file
is modified.
|
repl
|
If a file with the same name already exists, it
will be replaced if this parameter is set to true.
|
qual
|
The optional quality for the match - normal,
draft or best (cmNormalMode,
cmDraftMode or cmBestMode ).
|
lnkProf
|
The device link profile for the match.
|
lnkIntent
|
The rendering intent for the match - perceptual
intent, relative colorimetric intent, saturation
intent or absolute colorimetric intent
(cmPerceptual, cmRelativecolorimetric,
cmSaturation or
cmAbsoluteColorimetric ).
|
DESCRIPTION
Use this function to match an image file with a device
link profile.
CMError CMCountImageProfiles (const FSSpec *spec,
UInt32 *count);
|
Field Descriptions
spec
|
A file specification for the image file.
|
count
|
A count of the embeded profiles for the image is
returned here.
|
DESCRIPTION
Use this function to obtain a count of the number of
embeded profiles for a given image.
CMError CMGetIndImageProfile (const FSSpec *spec,
UInt32 index,
CMProfileRef *prof);
|
Field Descriptions
spec
|
A file specification for the image file.
|
index
|
The numeric index of the profile to return.
|
prof
|
The profile is returned here.
|
DESCRIPTION
Use this function to obtain a specific embeded profile
for a given image.
CMError CMSetIndImageProfile (const FSSpec *specFrom,
const FSSpec *specInto,
Boolean repl,
UInt32 index,
CMProfileRef prof);
|
Field Descriptions
specFrom
|
A file specification for the image file.
|
specInto
|
If this parameter is a file, it specifies the
resulting image. If this parameter is a folder, it
specifies the location of the resulting image which
will have the same name as the original file. If
this parameter is not provided, the original file
is modified.
|
repl
|
If a file with the same name already exists, it
will be replaced if this parameter is set to true.
|
index
|
The numeric index of the profile to set.
|
prof
|
The profile to set at the index designated by
the index parameter.
|
DESCRIPTION
Use this function to set a specific embeded profile for a
given image.
New CMBitmap Types
Several new CMBitmap spaces were added in
ColorSync 2.6 (see below) to provide developers with a wide
range of data formats appropriate for multiple platforms.
Several bitmap spaces now can have a new space attribute
flag cmLittleEndianPacking set to indicate
Little-Endian data. Another new variant
cmReverseChannelPacking , which can apply to
just about all of the new and old spaces is a "reverse
channels" attribute.
Bitmap spaces supported in ColorSync 2.5
- cmGray16Space = cmGraySpace,
- cmGrayA32Space = cmGrayASpace,
- cmRGB16Space = cmWord5ColorPacking + cmRGBSpace,
- cmRGB24Space = cm24_8ColorPacking + cmRGBSpace,
- cmRGB32Space = cm32_8ColorPacking + cmRGBSpace,
- cmRGB48Space = cm48_16ColorPacking + cmRGBSpace,
- cmARGB32Space = cm32_8ColorPacking +
cmAlphaFirstPacking + cmRGBASpace,
- cmRGBA32Space = cm32_8ColorPacking +
cmAlphaLastPacking + cmRGBASpace,
- cmCMYK32Space = cm32_8ColorPacking + cmCMYKSpace,
- cmCMYK64Space = cm64_16ColorPacking + cmCMYKSpace,
- cmHSV32Space = cmLong10ColorPacking + cmHSVSpace,
- cmHLS32Space = cmLong10ColorPacking + cmHLSSpace,
- cmYXY32Space = cmLong10ColorPacking + cmYXYSpace,
- cmXYZ32Space = cmLong10ColorPacking + cmXYZSpace,
- cmLUV32Space = cmLong10ColorPacking + cmLUVSpace,
- cmLAB24Space = cm24_8ColorPacking + cmLABSpace,
- cmLAB32Space = cmLong10ColorPacking + cmLABSpace,
- cmLAB48Space = cm48_16ColorPacking + cmLABSpace,
- cmGamutResult1Space = cmOneBitDirectPacking +
cmGamutResultSpace,
- cmNamedIndexed32Space = cm32_32ColorPacking +
cmNamedIndexedSpace,
- cmMCFive8Space = cm40_8ColorPacking + cmMCFiveSpace,
- cmMCSix8Space = cm48_8ColorPacking + cmMCSixSpace,
- cmMCSeven8Space = cm56_8ColorPacking +
cmMCSevenSpace,
- cmMCEight8Space = cm64_8ColorPacking + cmMCEightSpace
New Spaces added for 2.6
- cmGray8Space = cmGraySpace + cm8_8ColorPacking, 8-bit
gray
- cmGrayA16Space = cmGrayASpace + cm16_8ColorPacking,
8-bit gray + 8-bit alpha
- cmGray16LSpace = cmGraySpace + cmLittleEndianPacking,
16-bit gray, little-endian
- cmGrayA32LSpace = cmGrayASpace +
cmLittleEndianPacking, 16-bit gray + 16-bit alpha,
little-endian
- cmRGB565Space = cmRGBSpace + cmWord565ColorPacking,
Variant of 1.5.5.5
- cmRGB565LSpace = cmRGBSpace + cmWord565ColorPacking +
cmLittleEndianPacking, Variant of 1.5.5.5, little-endian
- cmRGB16LSpace = cmRGBSpace + cmWord5ColorPacking +
cmLittleEndianPacking, 1.5.5.5, little-endian
- cmRGB48LSpace = cmRGBSpace + cm48_16ColorPacking +
cmLittleEndianPacking, 16-bits per channel RGB,
little-endian
- cmARGB64Space = cmRGBASpace + cm64_16ColorPacking +
cmAlphaFirstPacking, 16-bits per channel RGB w/leading
alpha channel
- cmARGB64LSpace = cmRGBASpace + cm64_16ColorPacking +
cmAlphaFirstPacking + cmLittleEndianPacking, bits / chl
RGB w/leading alpha, little-endian
- cmRGBA64Space = cmRGBASpace + cm64_16ColorPacking +
cmAlphaLastPacking, 16-bits / chl RGB with trailing alpha
channel
- cmRGBA64LSpace = cmRGBASpace + cm64_16ColorPacking +
cmAlphaLastPacking + cmLittleEndianPacking bits / chl RGB
w/trailing alpha, little-endian
- cmCMYK64LSpace = cmCMYKSpace + cm64_16ColorPacking +
cmLittleEndianPacking, 16-bits per channel CMYK,
little-endian
- cmXYZ24Space = cmXYZSpace + cm24_8ColorPacking, 8-bit
per channel XYZ
- cmXYZ48Space = cmXYZSpace + cm48_16ColorPacking,
16-bits per channel XYZ
- cmXYZ48LSpace = cmXYZSpace + cm48_16ColorPacking +
cmLittleEndianPacking, 16-bits
- per channel XYZ, little-endian
- cmLAB48LSpace = cmLABSpace + cm48_16ColorPacking +
cmLittleEndianPacking, 16-bits per channel Lab,
little-endian
- cmNamedIndexed32LSpace = cm32_32ColorPacking +
cmNamedIndexedSpace + cmLittleEndianPacking, 32-bit
index, little-endian
ICC Profile Description ('desc' ) Tag
Handling
One important change in the recent release of ColorSync
(version 2.6) is how it handles the description
('desc' ) tag of ICC profiles.
The 'desc' tag of a profile, as defined by
the ICC, contains up to three strings. The first is a
required 7-bit Roman ASCII string. The second is an optional
localized Unicode string. The third, also optional, is a
localized string in Mac script-code format. Applications
typically use one of the available strings to show the name
of profiles in a list or pop-up menu. There are a few other
important devilish details in the ICC definition of the
'desc' tag. One is that all three strings must
be null terminated. Another is that all three strings are
preceded by a character count that includes the null
terminator. It is also worth noting that for the Unicode
string, the character count must not be confused with a byte
count because each Unicode character requires two bytes.
Previous releases of ColorSync only make partial use of
this tag and, as a result, only performed limited error
checking on its contents. For example, The ColorSync
function CMGetScriptProfileDescription would
return the Mac script-code from a profile if it was present
and, if not, it would return the 7-bit Roman ASCII string.
The Unicode string was simply ignored and in some cases, if
the Unicode and/or Mac script-code string were
non-compliant, ColorSync would return garbage (or the ASCII
string if you were lucky) without returning
cmProfileErr code.
ColorSync 2.6 provides a new function,
CMGetProfileDescriptions , to give the user
access to all three possible strings in the 'desc'
tag. In doing so, much stricter attention had to be
paid to the compliance of the 'desc' tag. For
example, if either the ASCII string or the Mac script-code
strings is not null terminated, or if any of the string's
character counts are invalid or beyond the range of the
'desc' tag, the and cmProfileErr
code is returned.
In order to achieve optimal performance when applications
add profiles to a list or pop-up menu, ColorSync maintains a
cache of all the profiles installed in the "ColorSync
Profiles" folder and its sub-directories. Among other things
this cache file contains the three possible names of each
profile obtained by calling
CMGetProfileDescriptions . If
CMGetProfileDescriptions returns an error
because the 'desc' tag is non-compliant, then
the profile is not added to the cache. This is why
non-compliant profiles, even though they are properly
installed in the "ColorSync Profiles" folder, no longer show
up in the ColorSync control panel or the ColorSync plug-ins
pop-up menus with ColorSync 2.6 installed.
The remedy for this problem is to repair the affected
profiles. Unfortunately, the "Rename Profile" AppleScript
that is installed as part of ColorSync 2.6 can not be used
to repair profiles with bad 'desc' tags because
it can only operate on profiles in the ColorSync profile
cache. Instead, a simple stand-alone tool called "Profile
First Aid" to verify and repair any profile will be made
available on the the ColorSync web site
<http://www.apple.com/colorsync>.
Back to top
ColorSync 2.6 Compatibility Issues
ColorSync 1.X/2.X Support
Support for version 1.0 profiles and hybrid (1.0/2.0)
color worlds has been removed in ColorSync 2.6. ColorSync
1.0 profiles, APIs and CMMs are not supported.
CMM
No longer required to support ColorSync 1.0 Profiles.
Existing CMMs will be compatible.
New CMM APIs: NCMConcatInit ,
NCMMNewLinkProfile (see section
"New CMM APIs" for the details) which
a CMM may choose to implement. If a given CMM does not
implement these new APIs, the default CMM is invoked
instead.
Profile Searching
ColorSync 2.6 will support new profile locations (System
Folder) for Profile searches made with the search functions
(CMNewProfileSearch , etc.). Profiles in
subfolders within the profiles folder will be found as well.
Color Worlds
New API NCWConcatColorWorld (see section
"New ColorSync 2.6 APIs" for the
details) puts power and responsibility of color world design
into the hands of developers. Callers can select which
profile tags and rendering intents to use. It also allows
for new combinations of profiles which were previously not
supported (e.g., more than one device-link profile).
QuickDraw Matching
2.X QuickDraw calls will continue to be supported
(N/NCMBeginMatching ,
CMEndMatching ,
N/CMDrawMatchedPicture ,
CWMatchPixMap , CWCheckPixMap ).
Scripting & File Formats
JPEG, GIF as well as TIFF file format plug-ins are now
supported.
Back to top
|